package cn.itcast.dewu.controller;

import cn.itcast.dewu.dto.Result;
import cn.itcast.dewu.service.GoodsService;
import cn.itcast.dewu.service.GoodsTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/*查询所有商品的类型*/
@RestController
@RequestMapping("/goods-type")
public class GoodsTypeController {
    @Autowired
    private GoodsTypeService goodsTypeService;
    @Autowired
    private GoodsService goodsService;

    @GetMapping
    public Result typeList() {
        return goodsTypeService.queryByOrderSort();
    }

    /*
     * 查看某一类型的商品
     * */
    @GetMapping("/{id}")
    public Result querTypeOne(@PathVariable("id") Long id) {
        return goodsTypeService.querTypeOne(id);
    }
}
